package email.com.gmail.wynnwktran.fruitbasket;

public class Apple extends Fruit {
	
	private boolean hasWorm = false;

	@Override
	public void eat() {
		System.out.println("Yum, that's one tasty apple.");
	}
	
	// Effects: records that this apple has a worm
	public void addWorm() {
		hasWorm = true;
		System.out.println("Yikes! There's a worm in here!");
	}
	
	// Effects: returns false if this apple does not have a worm,
	// prints "Eww, there's a worm in this apple!" if this apple and returns true if this apple has a worm
	public boolean checkForWorm() {
		if (hasWorm == true) {
			System.out.println("Eww, there's a worm in this apple!");
		}
		return hasWorm;
	}

}
